function instanceOf(L, R) {
  let N = Object.getPrototypeOf(L)
  let O = R.prototype
  while (N) {
    if (N === O) return true
    N = N.__proto__
  }
  return false
}

let res = instanceOf([1, 2, 3], Array)
console.log(res);